project.LoginClass = new Class({
    Extends : project.Details,

    initDetails : function() {
        this.options.path = project.basePath ;
    } ,

    refreshCode: function(){
        $("#captchaCode").attr("src", "/captcha?t=" + $.now());
    },
    submit : function submit() {
        var currObj = this;
        $.ajax({
            type: "POST",
            url: "/sys/login",
            data: $("#loginForm").serialize(),
            success: function (data) {
                if(!data){
                    currObj.refreshCode();
                }
                //判断是登陆正确
                if(data.success){//登录成功
                    location.href ='/index';
                }else {
                    layer.msg(data.message);
                    currObj.refreshCode();
                }
            },
            error: function (a,b,c) {
            }
        });
    }
});

$(document).ready(function(){
    new project.LoginClass ;
});